package org.kotboot.kit;/**
 * Created by jisong.sun on 2017/9/14.
 */

import java.util.regex.Pattern;

/**
 * jisong.sun 2017/9/14 17:00
 */
public class RegKit {

    //邮箱
    public static final Pattern email = Pattern.compile("^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$");
    //手机号
    public static final Pattern mobile = Pattern.compile("^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$");
    public static final Pattern pwd  =Pattern.compile("^[0-9a-z]{64}$");

    public static final Pattern orderBy = Pattern.compile("^[a-zA-Z_]+( (ASC|asc|DESC|desc)(,[a-zA-Z_]+( (ASC|asc|DESC|desc))?)?)?$");

    public static boolean isMoble(String str){
        return mobile.matcher(str).find();
    }

    public static boolean isMail(String str) {
        return email.matcher(str).find();
    }
}
